package com.scbo.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class MySQLiteHelper extends SQLiteOpenHelper {
	public static final String TABLE_ITEMBO = "itemBO";
	public static final String ITEMBO_ID = "_id";
	public static final String ITEMBO_IDTYPE = "idType";
	public static final String ITEMBO_TEXT = "text";
	public static final String ITEMBO_TTS = "textToSpeech";
	public static final String ITEMBO_TIME = "time";
	public static final String ITEMBO_URL = "soundUrl";
	
	public static final String TABLE_BUILDORDER = "buildOrder";
	public static final String BUILDORDER_ID = "_id";
	public static final String BUILDORDER_NAME = "name";
	public static final String BUILDORDER_NOTE = "note";
	public static final String BUILDORDER_LINK = "link";
	public static final String BUILDORDER_TYPEMATCH = "typeMatch";
	public static final String BUILDORDER_Mode = "typeMod";
	public static final String BUILDORDER_HTML = "html";

	private static final String DATABASE_NAME = "scbo.db";
	private static final int DATABASE_VERSION = 1;

	// Database creation sql statement
	private static final String DATABASE_CREATE_ITEMBO = "create table "
			+ TABLE_ITEMBO + "(" + ITEMBO_ID + " integer primary key autoincrement, " + ITEMBO_IDTYPE	+ " integer, " + ITEMBO_TEXT + " text, " + ITEMBO_TTS + " text, "+ ITEMBO_TIME + " integer, " + ITEMBO_URL + " text);";
	
	private static final String DATABASE_CREATE_BUILDORDER = "create table "
			+ TABLE_BUILDORDER + "(" + BUILDORDER_ID + " integer primary key autoincrement, " + BUILDORDER_NAME	+ " text, " + BUILDORDER_NOTE + " text, " + BUILDORDER_LINK + " text, "+ BUILDORDER_TYPEMATCH + " integer, " 
			+ BUILDORDER_Mode + " integer, " + BUILDORDER_HTML + " text);";

	public MySQLiteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(DATABASE_CREATE_ITEMBO);
		db.execSQL(DATABASE_CREATE_BUILDORDER);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}

}
